﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using Fatec.ControleEstoque.Attributes;
using Fatec.ControleEstoque.Attributes.Security;
using System.Data;
using System.Web;
using Fatec.ControleEstoque.Attributes.Templates;

namespace Fatec.ControleEstoque.Data.Model
{
    [Security(Role = "Estoque", Action = "All")]
    [MetadataType(typeof(EstoqueMetadata))]
    public partial class Estoque : IValidatable
    {
        public class EstoqueMetadata
        {
            [DisplayName("Código")]
            [ReadOnly(true)]
            [HideColumnIn(PageTemplate.Insert)]
            public object Id { get; set; }
            
            [DisplayName("Tipo")]
            public object Tipo_Estoque { get; set; }
        }

            #region IValidatable Members

            public bool Validate(EntityState state)
            {
                if (HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    if (state == EntityState.Added)
                    {
                    }
                }
                else
                {
                    HttpContext.Current.Response.Redirect("Login.aspx");
                }
                

                return string.IsNullOrEmpty(ExceptionMessage);
            }

            public string ExceptionMessage { get; set; }

            #endregion
        }
    }

